//
//  File.swift
//
//
//  Created by didi on 2022/9/13.
//

import MolecularObjects
import Vapor

public protocol AsyncValidator {
    var key: String { get }
    var message: String { get }

    func validate(_ req: Request) async throws -> ErrorDetail?
}

public extension AsyncValidator {
    var error: ErrorDetail {
        .init(key: key, message: message)
    }
}
